package cn.cheln.support.dialog;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.view.View;

public class DialogUtil
{
  public static DialogInterface.OnClickListener getNewCancelOption(Context paramContext)
  {
    return getNewCancelOption(paramContext, false);
  }

  public static DialogInterface.OnClickListener getNewCancelOption(Context paramContext, boolean paramBoolean)
  {
    return new DialogInterface.OnClickListener()
    {
      public void onClick(DialogInterface paramDialogInterface, int paramInt)
      {
        paramDialogInterface.cancel();
        paramDialogInterface.dismiss();
      }
    };
  }

  public static AlertDialog showChoiceDialog(DialogAbstract paramDialogAbstract)
  {
    return showChoiceDialog(paramDialogAbstract, false);
  }

  public static AlertDialog showChoiceDialog(DialogAbstract paramDialogAbstract, boolean paramBoolean)
  {
    if (paramDialogAbstract.context == null)
      throw new IllegalStateException("contxet is null");
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(paramDialogAbstract.context).setCancelable(paramBoolean).setPositiveButton(paramDialogAbstract.positiveButtonText, paramDialogAbstract.positiveButtonClickListener).setNegativeButton(paramDialogAbstract.negativeButtonText, paramDialogAbstract.negativeButtonClickListener);
    if (paramDialogAbstract.title != null)
      localBuilder.setTitle(paramDialogAbstract.title);
    if (paramDialogAbstract.iconId != 0)
      localBuilder.setIcon(paramDialogAbstract.iconId);
    if (paramDialogAbstract.message != null)
      localBuilder.setMessage(paramDialogAbstract.message);
    return localBuilder.show();
  }

  public static AlertDialog showNeutralDialog(DialogAbstract paramDialogAbstract)
  {
    return showNeutralDialog(paramDialogAbstract, false);
  }

  public static AlertDialog showNeutralDialog(DialogAbstract paramDialogAbstract, boolean paramBoolean)
  {
    return new AlertDialog.Builder(paramDialogAbstract.context).setTitle(paramDialogAbstract.title).setIcon(paramDialogAbstract.iconId).setMessage(paramDialogAbstract.message).setNeutralButton(paramDialogAbstract.neutralButtonText, paramDialogAbstract.neutralButtonClickListener).setCancelable(paramBoolean).setView(paramDialogAbstract.view).show();
  }

  public void closeHintNBackToLauncher(DialogInterface paramDialogInterface, Context paramContext)
  {
    paramDialogInterface.dismiss();
    paramDialogInterface.cancel();
    ((Activity)paramContext).finish();
  }

  public static class DialogAbstract
  {
    public Context context;
    public int iconId;
    public String message;
    public DialogInterface.OnClickListener negativeButtonClickListener;
    public String negativeButtonText;
    public DialogInterface.OnClickListener neutralButtonClickListener;
    public String neutralButtonText;
    public DialogInterface.OnClickListener positiveButtonClickListener;
    public String positiveButtonText;
    public String title;
    public View view;
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     cn.cheln.support.dialog.DialogUtil
 * JD-Core Version:    0.5.2
 */